---
# title: "Rotate"
title: "旋转"
# description: "Utilities for rotating elements with transform."
description: "用于旋转元素的功能类。"
---

import plugin from 'tailwindcss/lib/plugins/rotate'
import { Variants } from '@/components/Variants'
import { Disabling } from '@/components/Disabling'

export const classes = { plugin }

<!-- ## Usage -->
## 使用

<!-- Rotate an element by first enabling transforms with the `transform` utility, then specifying the rotation angle using the `rotate-{angle}` utilities. -->
首先使用 `transform` 功能类启用变换，然后使用 `rotate-{angle}` 功能类指定旋转角度来旋转一个元素。

```html lightBlue
<template preview>
  <div class="flex flex-col justify-around space-y-12 md:flex-row md:space-y-0 md:space-x-12">
    <div class="w-16 h-16 bg-light-blue-400 bg-stripes bg-stripes-white">
      <img class="h-16 w-16 transform rotate-0" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80">
    </div>
    <div class="w-16 h-16 bg-light-blue-400 bg-stripes bg-stripes-white">
      <img class="h-16 w-16 transform rotate-45" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80">
    </div>
    <div class="w-16 h-16 bg-light-blue-400 bg-stripes bg-stripes-white">
      <img class="h-16 w-16 transform rotate-90" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80">
    </div>
    <div class="w-16 h-16 bg-light-blue-400 bg-stripes bg-stripes-white">
      <img class="h-16 w-16 transform rotate-180" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80">
    </div>
  </div>
</template>

<img class="transform **rotate-0** ...">
<img class="transform **rotate-45** ...">
<img class="transform **rotate-90** ...">
<img class="transform **rotate-180** ...">
```

<!-- Note that because Tailwind implements transforms using [CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), **the transform utilities are not supported in older browsers like IE11**. If you need transforms for your project and need to support older browsers, [add your own utilities](/docs/adding-new-utilities) or other custom CSS. -->
请注意，因为 Tailwind 使用[ CSS 自定义属性](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)来实现变换，**变换功能不支持旧的浏览器，如 IE11**。如果您的项目需要变换，并且需要支持旧的浏览器，[添加您自己的功能类](/docs/adding-new-utilities)或其他自定义 CSS。

<!-- ## Responsive -->
## 响应式

<!-- To control the rotation of an element at a specific breakpoint, add a `{screen}:` prefix to any existing rotate utility. For example, use `md:rotate-90` to apply the `rotate-90` utility at only medium screen sizes and above. -->
要在特定的断点处控制元素的旋转，请在任何现有的旋转功能类中添加 `{screen}:` 前缀。例如，使用 `md:rotate-90` 来应用 `rotate-90` 功能类在中等尺寸以上的屏幕上。

```html
<div class="transform rotate-45 **md:rotate-90**"></div>
```

<!-- For more information about Tailwind's responsive design features, check out the [Responsive Design](/docs/responsive-design) documentation. -->
关于 Tailwind 的响应式设计功能的更多信息，请查看[响应式设计](/docs/responsive-design)文档。

<!-- ## Customizing -->
## 自定义

### Rotate scale

<!-- By default Tailwind provides seven general purpose rotate utilities. You change, add, or remove these by editing the `theme.rotate` section of your Tailwind config. -->
默认情况下，Tailwind 提供了七个通用的旋转功能类。您可以通过编辑您的 Tailwind 配置的 `theme.rotate` 部分来改变，添加或删除这些功能类。

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      rotate: {
-       '-180': '-180deg',
        '-90': '-90deg',
-       '-45': '-45deg',
        '0': '0',
        '45': '45deg',
        '90': '90deg',
+       '135': '135deg',
        '180': '180deg',
+       '270': '270deg',
      }
    }
  }
```

<!-- Learn more about customizing the default theme in the [theme customization documentation](/docs/theme#customizing-the-default-theme). -->
在[主题定制文档](/docs/theme#-5)中了解更多关于定制默认主题的信息。

<!-- ### Variants -->
### 变体

<Variants plugin="rotate" />

<!-- ### Disabling -->
### 禁用

<Disabling plugin="rotate" />
